<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/sys/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%@ include file="/WEB-INF/adminui/include/css.jsp" %>
<title>特色基地</title>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
	<div class="row">
		<div class="col-sm-2" style="width:20%">
			<div class="ibox ibox-body">
				<div class="ibox-title">
					<h5>选择园区</h5>
				</div>
				<div class="ibox-content">
					<div id="jstree"></div>
				</div>
			</div>
		</div>
		<div class="col-sm-10" style="width:78%">
			<div class="ibox">
				<div class="ibox-body">
					<div class="fixed-table-toolbar">
						<div id="toolbar" class="columns pull-left">
							<c:if test="${tstype == 1 }">
								<qx:perm code="park_tese_zizhi_add">
								<button type="button" class="btn btn-primary" onclick="add()">
									<i class="fa fa-plus hidden" aria-hidden="true"></i>添加
								</button>
								</qx:perm>
								<qx:perm code="park_tese_zizhi_del">
								<button type="button" class="btn btn-danger multi" onclick="del()">
									<i class="fa fa-trash hidden" aria-hidden="true"></i>删除
								</button>
								</qx:perm>
							</c:if>
							<c:if test="${tstype == 2 }">
								<qx:perm code="park_tese_zhidu_add">
								<button type="button" class="btn btn-primary" onclick="add()">
									<i class="fa fa-plus hidden" aria-hidden="true"></i>添加
								</button>
								</qx:perm>
								<qx:perm code="park_tese_zhidu_del">
								<button type="button" class="btn btn-danger multi" onclick="del()">
									<i class="fa fa-trash hidden" aria-hidden="true"></i>删除
								</button>
								</qx:perm>
							</c:if>
							<c:if test="${tstype == 3 }">
								<qx:perm code="park_tese_chanpin_add">
								<button type="button" class="btn btn-primary" onclick="add()">
									<i class="fa fa-plus hidden" aria-hidden="true"></i>添加
								</button>
								</qx:perm>
								<qx:perm code="park_tese_chanpin_del">
								<button type="button" class="btn btn-danger multi" onclick="del()">
									<i class="fa fa-trash hidden" aria-hidden="true"></i>删除
								</button>
								</qx:perm>
							</c:if>
						</div>
						<div class="columns pull-right">
							<button class="btn btn-success" onclick="UiList.loadTable()">查询</button>
						</div>
						<div class="columns pull-right col-md-2 nopadding" style="width:200px;">
							<input id="searchName" type="text" class="form-control" placeholder="按基地标题查询">
						</div>
					</div>
					<table id="dataTable" data-mobile-responsive="true">
					</table>
				</div>
			</div>
		</div>
	</div>
</div>
<%@ include file="/WEB-INF/adminui/include/script.jsp" %>
<script type="text/javascript">
$(function(){
	UiList.render({
		treeUrl: '${path}/parkjstree/menudata.json?module=park',
		tableConfig:{
			url: "${path}/park/listdataTese.json?tstype=${tstype}",
			idfield: 'parktsid',
			columns: [
				{checkbox : true},
				{field : 'parkName', title : '所属园区'},
				{field : 'title', title : '标题'},
				{field : 'create_time', title : '创建时间', formatter : function(value, row, index) {
					return formatDate(value, 'yyyy-MM-dd HH:mm:ss');
				}},
				{field : 'parktsid', title : '操作', align : 'center', formatter : function(value, row, index) {
					var s = '';
					var type = '${tstype}'
					if(type == 1){
						<qx:perm code="park_tese_zizhi_edit">
						s += '<a class="btn btn-primary btn-sm" href="javascript:;" title="修改" onclick="edit(\''+value+'\')">修改</a>';
						</qx:perm>
					}else if(type == 2){
						<qx:perm code="park_tese_zhidu_edit">
						s += '<a class="btn btn-primary btn-sm" href="javascript:;" title="修改" onclick="edit(\''+value+'\')">修改</a>';
						</qx:perm>
					}else if(type == 3){
						<qx:perm code="park_tese_chanpin_edit">
						s += '<a class="btn btn-primary btn-sm" href="javascript:;" title="修改" onclick="edit(\''+value+'\')">修改</a>';
						</qx:perm>
					}
					
					return s;
				}}
			]
		},
		tableParams: function(){//搜索条件
			return {title: $("#searchName").val()};
		}
	});
	
});

function add(){
	UiList.open('${path}/park/addTese.do?tstype=${tstype}', '添加基地信息',{full:true});
}
function del(){
	UiList.dialog('${path}/park/deleteTese.json', '您确定要删除选中的基地信息吗？', '删除基地信息成功.');
}
function edit(id){
	UiList.open('${path}/park/editTese.do?parktsid='+id, '修改基地信息',{full:true});
}
</script>
</body>
</html>